package com.shilei.builder;

/**
 * @description: 复杂的人类
 * @author: 81271
 * @date: 2020-04-22 19:49
 */
public class Person {
    private int id;
    private String name;
    private int age;
    private int weight;
    private int score;
    private Location location;

    public static class PersonBuilder {
        Person p = new Person();

        public PersonBuilder basicInfo(int id, String name, int age) {
            p.id = id;
            p.name = name;
            p.age = age;
            return this;
        }

        public PersonBuilder weight(int weight) {
            p.weight = weight;
            return this;
        }

        public PersonBuilder score(int score) {
            p.score = score;
            return this;
        }

        public PersonBuilder location(String street, String roomNo) {
            p.location = new Location(street, roomNo);
            return this;
        }

        public Person build() {
            return p;
        }

    }

}

class Location {
    String street;
    String roomNo;

    public Location(String street, String roomNo) {
        this.street = street;
        this.roomNo = roomNo;
    }
}
